#coding:utf-8
from django.http import HttpResponseRedirect,HttpResponse,HttpResponseForbidden,Http404
from django.template import RequestContext
from django.shortcuts import render_to_response, get_object_or_404
from order.models import Userinfo,Dish,Package,Order
import time


def login(request):
    return render_to_response('login.htm')

def today(request):
    ISOTIMEFORMAT = '%Y-%m-%d'
    timemark = time.strftime( ISOTIMEFORMAT, time.gmtime( time.time() ))
    packages = Package.objects.filter(date_deal=timemark).order_by('create_at')
    #packages = Package.objects.all()
    return render_to_response('today.htm', {'package':packages, 'today':timemark})

def dish(request, num):
    if not num:
        return Http404
    dish = Dish.objects.get(id=num)
    return render_to_response('dish.htm', {'dish': dish})
